package com.ra.jalmanac.hibernate.dao;

import java.io.Serializable;
import java.util.Date;
import java.util.List;

import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.Id;
import javax.persistence.Table;
import javax.persistence.Temporal;
import javax.persistence.TemporalType;

@Entity
@Table(name = "BOOK",catalog="", schema="JALMANAC")
public class Book implements Serializable {
    private static final long serialVersionUID = 1L;

    @Id  @GeneratedValue
    private String isbn;
    
    @Column
    private String name;
    @Column
    @Temporal(TemporalType.DATE)
    private Date publishDate;
    @Column
    private int price;
    
//    private Publisher publisher;
//    private List chapters;

    public String getIsbn() {
        return isbn;
    }

    public void setIsbn(String isbn) {
        this.isbn = isbn;
    }

    public String getName() {
        return name;
    }

    public void setName(String name) {
        this.name = name;
    }

    public Date getPublishDate() {
        return publishDate;
    }

    public void setPublishDate(Date publishDate) {
        this.publishDate = publishDate;
    }

    public int getPrice() {
        return price;
    }

    public void setPrice(int price) {
        this.price = price;
    }

    @Override
    public String toString() {
        return String
                .format(
                "Book [\t isbn=%s, \n\t name=%s, \n\t price=%s, \n\t publishDate=%s]",
                isbn, name, price, publishDate);
    }
}
